import './public/toastr'
import server from './date/url'

$(function () {

  $('#getCredit').on('click', (e) => {
    e.preventDefault()
    
    let loadingLayer = layer.msg('加载中', {
          icon: 16,
          shade: .6,
          time: 0
        })

    $.ajax({
      url: server,
      type: 'POST',
      data: {
        task: '2getReport',
        stamp: new Date().getTime()
      }
    })
    .done(function(res) {
      console.log("success")
      console.log(res)

      if (res.status) {
        window.location = '/identifyTest.html'
      } else {
        layer.msg(res.message || '', {
          time: 2000
        })
      }

    })
    .fail(function(res) {
      console.log("error")
      console.log(res)
    })
    .always(function() {
      layer.close(loadingLayer)
    })

    // window.location.href = './identifyTest.html'
    
  })
})




